<?php
// 本类由系统自动生成，仅供测试用途
class ShopAction extends Action {
    public function index(){
    	$shop=M('Shop');
    	Import('ORG.Util.Page');
    	$count=$shop->count();
    	$page=new Page($count,10);
    	$show=$page->show();
    	$rows=$shop->limit($page->firstRow.','.$page->listRows)->select();
    	$this->assign('show',$show);
    	$this->assign('rows',$rows);
    	$this->display();
	}

	// 添加分类
	public function add(){
		$rows=D('Shop')->getDataAll();
		$this->assign('rows',$rows);
		$this->display();
	}

	// 添加分类操作
	public function add_handle(){
		$Shop=M('Shop');
		if($Shop->create()){
			if($Shop->add()){
				$this->redirect('index');
			}
			
		}
	}

	// 编辑
	public function edit(){
		$shopid=$_GET['shopid'];
		$rows=D('Shop')->getDataAll();


		$this->display();
	}
	// 编辑操作
	public function edit_handle(){
		$Shop=M('Shop');
		if($Shop->create()){
			if($Shop->save($_POST)){
				$this->redirect('index');
			}else{
				echo'no';
			}
			
		}
	}

	// 删除
	public function delete(){
		$Shop=M('Shop');
		$shopid=$_GET['shopid'];
		if($Shop->delete($shopid)){
			$this->redirect('index');
		}
		
	}

	// 百度地图
	public function baidu(){
		$this->display();
	}
}